import request from '@/network'

// 获取类型
export const queryTypesRequest = async (currentPage: number = 1, pageSize: number = 7) => {
  const result = await request.get({
    url: '/type',
    params: {
      currentPage,
      pageSize,
    },
  })
  return result
}
// 获取所有类型
export const getAllTypesRequest = async () => {
  const result = await request.get({
    url: '/type/all',
  })
  return result
}
// 修改类型名称
export const updateTypeNameRequest = async (type_id: number, type_name: string) => {
  const result = await request.patch({
    url: '/type/update_type_name',
    data: {
      type_id,
      type_name,
    },
  })
  return result
}
// 删除类型
export const deleteTypeRequest = async (type_id: number) => {
  const result = await request.delete({
    url: '/type/delete_type',
    data: {
      type_id,
    },
  })
  return result
}
